home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-10-09 | 1.5 KB | 45 lines | [TEXT/MEDT] |
- MODULE DialogExample; (* demonstrates dialog handling *)
-
- FROM Dialog IMPORT Dialog, Item, New, Dispose, Close, UserAction, Button,
- Boolean, Enumeration, String, StaticString, TextStyle,
- windowItem;
-
- TYPE RadioType = (Button1,Button2);
- VAR dialog : Dialog;
- Quit, Cancel, Check,
- Radio, Text, TheItem : Item;
- RadioValue : RadioType;
- CheckValue : BOOLEAN;
- TextValue : ARRAY [0..63] OF CHAR;
-
- PROCEDURE Beep(Duration : INTEGER); CODE 0A9C8H;
- (* Code procedure, see chapter 8! *)
- BEGIN
- (* Create dialog *)
- New(dialog, 50,50,400,200);
- (* Define dialog items *)
- Button(dialog,Quit,TRUE,90,10,"Quit");
- Button(dialog,Cancel,FALSE,250,10,"Cancel");
- Boolean(dialog,Check,CheckValue,10,100,"Check Box");
- RadioValue := Button2;
- Enumeration(dialog,Radio,RadioValue,200,100,0,20,"Radio Button 1|Radio Button 2");
- TextValue := "This is an example.";
- String(dialog,Text,TextValue,10,50,364);
- StaticString(dialog,"Sample Dialog",150,150,Underline);
- (* Dialog defined; display it and monitor user's actions *)
- REPEAT
- LOOP
- IF UserAction(dialog,TheItem) THEN
- IF (TheItem = Quit) OR (TheItem = Cancel) THEN
- EXIT
- ELSIF (TheItem = windowItem) THEN
- Beep(5)
- END (* IF *)
- END (* IF *)
- END (* LOOP *);
- Close(dialog)
- UNTIL (TheItem = Quit);
- Dispose(dialog)
- END DialogExample.
-
-